package com.example.demo.util;

import org.apache.solr.client.solrj.SolrQuery;

import java.util.List;

/**
 * @author xiah
 * @date 2018/5/30 10:30
 */
public class SolrUtil {
       public static void addHighLightFilrd(SolrQuery solrQuery, List<String> list, String color) {
              /*开启高亮*/
              solrQuery.setHighlight(true);
              /*添加高亮字段*/
              list.stream().forEach(s -> {
                     solrQuery.addHighlightField(s);
              });
              /*设置前缀*/
              solrQuery.setHighlightSimplePre(ColorEnum.getByStoragePath(color));
              /*设置后缀*/
              solrQuery.setHighlightSimplePost("</span>");
       }
}
